<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <script type="text/javascript" language="javascript" src="jquery-3.1.1.min.js"></script>
    <script type="text/javascript" language="javascript" src="jquery-form.js"></script>
    <script type="text/javascript" language="javascript">
        $(function(){
            //异步提交表单
            $("#ajaxSubmit").on("click",function(){
                var timestamp = Date.parse(new Date());
                console.log($(this));
                $("#formToUpdate").ajaxSubmit({
                    type:'post',
                    url:'http://api-hiworld.haibian.com/teacher/class/mp3/upload',
//                    url:'http://upload-hiworld.testwaijiao.haibian.com/teacher/class/mp3/upload',
                    success:function(data){
                        console.log(Date.parse(new Date()) - timestamp);
                        console.log(data);
                        $("#content").text("use "+ (Date.parse(new Date()) - timestamp)+ " second;"
                        +" msg:"+data.message + "; code:" + data.code);
                    },
                    error:function(XmlHttpRequest,textStatus,errorThrown){
                        console.log(XmlHttpRequest);
                        console.log(textStatus);
                        console.log(errorThrown);
                    }
                });
            });
        });

        $(function(){
            //异步提交表单
            $("#ajaxSubmit1").on("click",function(){
                var timestamp = Date.parse(new Date());
                console.log($(this));
                $("#formToUpdate1").ajaxSubmit({
                    type:'post',
                    url:'http://upload-hiworld.testwaijiao.haibian.com/teacher/class/mp3/upload',
                    success:function(data){
                        console.log(Date.parse(new Date()) - timestamp);
                        console.log(data);
                        $("#content1").text("use "+ (Date.parse(new Date()) - timestamp)+ " second,"
                                +" msg:"+data.message + "; code:" + data.code);
                    },
                    error:function(XmlHttpRequest,textStatus,errorThrown){
                        console.log(XmlHttpRequest);
                        console.log(textStatus);
                        console.log(errorThrown);
                    }
                });
            });
        });
    </script>
</head>
<body>

<form id="formToUpdate" method="post" action="" enctype="multipart/form-data">
    <input type="file" name="file">
    <input id="ajaxSubmit" type="button" value="submit new">
    <p id="content"></p>
</form>

<form id="formToUpdate1" method="post" action="" enctype="multipart/form-data">
    <input type="file" name="file">
    <input id="ajaxSubmit1" type="button" value="submit old">
    <p id="content1"></p>
</form>

</body>
</html>